package k.daniel.android.util;

import android.util.Log;

/**
 * 将日志写入文件
 */
public class RunLog {

    public static final String DEFAULT_TAG = "\t";
    public static final String LINE = "-----------------------";
    public static final String START_LINE = "-----------------------START-------------------------";
    public static void v(String content) {
        v(content,DEFAULT_TAG);
    }
    public static void v(String content, Class clz) {
        v(content, clz.getSimpleName());
    }

    public static void v(String content, String tag) {
        Log.v(tag, content);
    }

    public static void i(String content) {
        i(content,DEFAULT_TAG);
    }
    public static void i(String content, Class clz) {
        i(content, clz.getSimpleName());
    }

    public static void i(String content, String tag) {
        Log.i(content, tag);
    }


    public static void w(String content, Class clz) {
        w(content, clz.getSimpleName());
    }

    public static void w(String content, String tag) {
        Log.w(content, tag);
    }

    public static void e(String content, Class clz) {
        e(content, clz.getSimpleName());
    }

    public static void e(String content, String tag) {
        Log.e(content, tag);
    }

    public static void wr(String content) {
        wr(content, DEFAULT_TAG);
    }

    /**
     * 开始一段Tag，仅开始
     * @param startClz
     */
    public static void wrs(Class startClz) {
        wrs(startClz.getSimpleName());
    }
    /**
     * 开始一段Tag，仅开始
     * @param startTag
     */
    public static void wrs(String  startTag) {
//
//        try {
//            File file = BaseEnviroment.getRunLogFile();
//            boolean append = true;
//            PrintWriter pw = null;
//            pw = new PrintWriter(new BufferedWriter(new FileWriter(
//                    file, append)));
//            pw.print("\n");
//            pw.print("\n");
//            pw.print(TimeFormatUtil.getCurrentTime(null));
//            pw.print(LINE);
//            pw.print(startTag + "\t" + "Start");
//            pw.print(LINE);
//            pw.print("\n");
//            pw.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
    /**
     * 结束一段Tag
     */
    public static void wre(Class startClz)
    {
        wre(startClz.getSimpleName());
    }

    public static void wre(String  endTag) {
//        try {
//            File file = BaseEnviroment.getRunLogFile();
//            boolean append = true;
////            PrintWriter pw = null;
////            pw = new PrintWriter(new BufferedWriter(new FileWriter(
////                    file, append)));
////            pw.print(TimeFormatUtil.getCurrentTime(null));
////            pw.print(DEFAULT_TAG);
////            pw.print(LINE);
////            pw.print(endTag+"\t"+"End");
////            pw.print(LINE);
////            pw.print("\n");
////            pw.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }


    /**
     * 寫入運行日誌
     * @param content
     * @param tag
     */
    public static void wr(String content, String tag) {
        Log.e(tag, content);
//        try {
//            File file = BaseEnviroment.getRunLogFile();
//            boolean append = true;
//            PrintWriter pw = null;
//            pw = new PrintWriter(new BufferedWriter(new FileWriter(
//                    file, append)));
//            pw.print(TimeFormatUtil.getCurrentTime(null));
//            pw.print("\t");
//            pw.print(tag);
//            pw.print("\t");
//            pw.println(content);
//            pw.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
}
